#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e4+10;
int n,m,s[MAXN],a[MAXN],f[MAXN],len;
int main()
{
	memset(s,0x3f3f3f3f,sizeof(s));
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	for(int i=n;i;--i)
	{
		int l=1,r=len;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(a[i]<s[mid])l=mid+1;
			else r=mid-1;
		}
		if(l>len)len=l;
		s[l]=a[i];
		f[i]=l;
	}
	scanf("%d",&m);
	while(m--)
	{
		int x;
		scanf("%d",&x);
		if(x>len)printf("Impossible");
		else
		{
			int _max=0;
			for(int i=1;i<=n;++i)
			{
				if(f[i]>=x&&a[i]>_max)
				{
					printf("%d",a[i]);
					if(x!=1)printf(" ");
					else break;
					_max=a[i];
					--x;
				}
			}
		}
		printf("\n");
	}
	return 0;
}
